p0,p1,p2,p3= r.corners() x0, y0 = p0 x1, y1 = p1 angle = math.atan2(y1-y0,x1-x0)