This is a challenge inspired by Chebyshev Rotation. I suggest looking at answers there to get inspiration for this challenge.
Given a point on the plane there is a unique square (a rectangle with equal sides) that is centered on the origin and intersects that point (interactive demo):
Given a point p and a distance d, return the point obtained by moving distance d from p, counter-clockwise (and clockwise for negative d), along the perimeter of the square centered on the origin that intersects p. Your answer must be accurate to at least 4 decimal digits.
Testcases:
(0, 0), 100 -> (0, 0)
(1, 1), 81.42 -> (-0.4200, 1.0000)
(42.234, 234.12), 2303.34 -> (-234.1200, 80.0940)
(-23, -39.234), -234.3 -> (39.2340, -21.8960)
The following test cases are from the original challenge by Martin Ender, and all are with d = 1:
(0, 0) -> (0, 0)
(1, 0) -> (1, 1)
(1, 1) -> (0, 1)
(0, 1) -> (-1, 1)
(-1, 1) -> (-1, 0)
(-1, 0) -> (-1, -1)
(-1, -1) -> (0, -1)
(0, -1) -> (1, -1)
(1, -1) -> (1, 0)
(95, -12) -> (95, -11)
(127, 127) -> (126, 127)
(-2, 101) -> (-3, 101)
(-65, 65) -> (-65, 64)
(-127, 42) -> (-127, 41)
(-9, -9) -> (-8, -9)
(126, -127) -> (127, -127)
(105, -105) -> (105, -104)