Fix issues with mouse coordinates on rectangular images