Pixel collisions: clip the rectangle to ensure pixel indexes are valid.