Finding the center of a rotating image.

So, I’m attempting to do some GUI tweening. Fun fun! But there’s one bit of math I’m having trouble with. Maybe you know the answer? As it stands, I’m rotating, scaling, moving, and fading a rectangularly shaped image (it must be rectangular, can’t make it square). And everything’s going well, but the pivot point is off the more I rotate. I know this because when I turn off the RotateAroundPivot command, the image appears to move correctly–whereas it does strange things when I use it. So, the question is this:

Given the upper left pixel coordinate and the width and height of an image, how do you calculate its pivot point? I get the feeling there’s some heavy trig to be considered here.

For example:

At one point, the rectangle will be rotated 17 degrees to the left (-17 degrees in Unity). Where is the pivot point (the center of the rectangle), in reference to the top left pixel coordinates?

Help and cheers,

Simon

Wouldn’t the center be at width/2, height/2?