A rectangle is drawn with the (x,y) coordinate as the upper left corner, and with a specified width and height.
Rotation of a rectangle occurs about a centroid which is defined as the center of the rectangle, or more formally as (x+w/2, y+h/2).
The following contains an example that will add a rectangle with a border to a canvas. The blue lines represent the x and y axes, and show through since an alpha value of 0.9 is used.
Rectangle drawn by example code below