Transforming a rectangle or polygon

Hello,

I am interested in using the Matplotlib transformation framework to
transform a rectangle into a different coordinate system. I am therefore
defining a Rectangle patch and setting the transform to what I want. If
I apply a non-linear transformation, the edges of the rectangle should
no longer necessarily be straight lines. Consider the following example:

···

---

import numpy as np

import matplotlib.pyplot as plt
from matplotlib.transforms import Affine2D
from matplotlib.patches import Rectangle, Polygon

fig = plt.figure()
ax = fig.add_subplot(1,1,1)

transform = Affine2D().rotate_deg(2) + ax.transData

# Add rectangle
r = Rectangle((0.5,0.5),width=10,height=10,
              transform=transform,
              edgecolor='red', facecolor='none')
ax.add_patch(r)

# Add oversampled rectangle
x = np.array([0.5, 10.5, 10.5, 0.5, 0.5])
y = np.array([0.5, 0.5, 10.5, 10.5, 0.51])
x_i = np.interp(np.linspace(0., 4., 10000), np.arange(5), x)
y_i = np.interp(np.linspace(0., 4., 10000), np.arange(5), y)
p = Polygon(list(zip(x_i, y_i)),
            transform=transform,
            edgecolor='green', facecolor='none')
ax.add_patch(p)

ax.set_xscale('log')
ax.set_yscale('log')

fig.savefig('test.png')

---

The green lines show what I would expect the rectangle to look like, and
the red is what it ends up looking like if I use the Rectangle patch.
What must be happening is that only the vertices of the rectangle get
transformed and then are connected by straight lines.

So my question is, is there a way to make the Rectangle patch behave
like the custom polygon I'm creating here?

Thanks for any advice,

Cheers,
Tom