Animation

t = 2.6 (slider from 0 to 6, step 0.025)
A = (6, 2)
B: A + (t, 0.0)
C: A + (t, 6.0 - t)
D: A + (0.0, 6.0 - t)
P, a, b, c, d = Polygon(A, B, C, D)
s: floor(t)
B': A + (s, 0.0)
C': A + (s, floor(6.0 - t))
D': A + (0.0, floor(6.0 - t))
Q, a_1, b', c', d' = Polygon(A, B', C', D')
M: (t, Q)
R, d_1, d'_1, c'_1, b'_1, b_1, c_1 = Polygon(D, D', C', B', B, C)
e = Segment(A, B)
f = OrthogonalLine(M, xAxis)
E = Intersect(f, xAxis)
g = Segment(M, E)
F = Point(yAxis)
h = Segment(F, E)