How would I do a left-to-right gradient for a rectangle that should use
anchors.fill: parent
for positioning?

The only "trick" for left-to-right gradient fill I have found so far has been to rotate the whole rectangle, but this (obviously) does more than I want. Obviously, the anchoring is calculated before the rectangle is rotated, not after, because it appears geometrically rotated.