[Bug 50715] Inaccurate calculation of endpoints of a rotated rectangle