GradientFill Rotation Pivot

Hi I have a problem with Gradient in AS3. There is a scene with Rectangle created with lineTo():

graphics.moveTo(p1.x, p1.y);
graphics.lineTo(p2.x, p2.y);
graphics.lineTo(p3.x, p3.y);
graphics.lineTo(p4.x, p4.y);

This has to be done this way as it is a part of papervision3D, perspective lines. It allows me to create some effect (I won’t go in to details how the rotating corner points are calculated as anyone can have a look in to papervision3D if interested)

My problem is that flash normaly offsets gradientBox position tx and ty by half of its width and height.
On first animation below you can see that gradient pivot point is offset by half of rectangle width and height and also that its position doesnt move together with rotating rectangle, which is bad I need it to move together with it.

in the second animation below I have compensated values of tx and ty:
gMatrix.createGradientBox(distance, distance, gAngle, vertex1.x - distance/2, vertex1.y - distance/2);
which partialy solves the problem, but now I can only see only the half of the gradient.

Has anyone got any ideas how to solve this problem?