Let your half sides be a
and b
.
If you rotate by alpha
, the rectangle vertex moves from (a,b)
to
(a*cos(alpha)-b*sin(alpha),a*sin(alpha)+b*cos(alpha))
(this is, basically, the complex multiplication).
Thus the red line is
a*sin(alpha)+b*(cos(alpha)-1)
and the yellow line is
a*(cos(alpha)-1)+b*sin(alpha)