Here is a version that calculates the rotation in relation to the rectangle's center.
RECT RotateRect (const Rect& r, double angle)
{
double sina = sin (angle);
double cosa = cos (angle);
double xc = (r.left + r.right) * 0.5;
double yc = (r.top + r.bottom) * 0.5;
double w2 = r.right - xc; double h2 = r.bottom - yc;
double dx = cosa * w2 - sina * h2;
double dy = sina * w2 + cosa * h2;
RECT q;
q.left = xc - dx;
q.top = yc - dy;
q.right = xc + dx;
q.bottom = yc + dy;
return q;
}
I have removed that static array, which actually belongs into the calling code. The function returns the rotated rectangle. I didn't take the time to debug that code, leaving that as an exercise for you.
Note that movement of the corners is symmetrical. Hence we need to calculate the new corner vector only once, and then add repsectively subtract it from the center.