Clamp coordinates in patchAtPixel