Fix bounds-checking for selections that lie partially off-image