Rotate a rectangle consisting of 4 tuples to left or right

I'm working on a program to manipulate GIS data, but for this precise problem, I'm trying to rotate a rectangle of 4 points around the bottom left corner. I've got 1 tuple describing the bottom left corner:

x, y=40000,40000

I've also got a length x, and a length y,

x_displacement

, and

y_displacement

. I've got an angle,

theta

, in degrees. I want to rotate the rectangle by up to 90 degrees left or right, so theta can be -89 to 89 degrees. Negative angles should rotate the corners to the left; positive angles to the right.I've represented the rectangle as such: http://i.imgur.com/pp3hFyA.jpg

I suspect that there's something relatively trivial that I'm doing wrong, but I've been stuck on this problem for quite some time.
This code produces a new rectangle that is either misshapen, or has negative corners, rather than slightly left-rotated corners as wanted.
I've seen many posts on here about rotating rectangles, but none seem to be a direct duplicate, because they do not handle negative angles. I'd appreciate any pointers!