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
Rectangle::pointer example_rectangle(bool fill, bool outline) { // Create a rectangle Papyrus::Rectangle::pointer rectangle = Papyrus::Rectangle::create( 80, 50 ); // Set the fill color to red, with an alpha value of 0.9 if (fill) rectangle->set_fill( Cairo::SolidPattern::create_rgba(1.0, 0.0, 0.0, 0.9) ); // And the outline color to black if (outline) rectangle->set_outline( Cairo::SolidPattern::create_rgba(0.0, 0.0, 0.0, 0.9) ); return rectangle; }