selectedRange

The selected block of cells, or null when nothing is anchored.

The rectangle runs between selectionAnchor and focusedCell; which of the two is the top-left corner depends on which way the user dragged, so read it through isCellInRange rather than comparing corners yourself.