I've noticed that no matter what the offset or scale of a texture is, the llRotateTexture() function always seems to rotate around the center of the surface in question. Kind of like this illustration:
http://lightsecond.com/pub/01_texrotate.swf
Is this observation accurate? So, I am wondering, how could you rotate a texture around a different point on the surface? Say the corner, like in here:
http://lightsecond.com/pub/02_texrotate.swf
or maybe even a point not on the surface, like in here:
http://lightsecond.com/pub/03_texrotate.swf
Keep in mind, I don't need a smooth animation effect (though I wouldn't argue with it

I took a stab at the math involved and I came up with this script, but it doesn't work so the math must be off base.
Thanks in advance for any advices! :]
float tmp;
float theta;
float dx;
float dy;
float realmod(float a, float b)
{
return( b *((a/b) - llFloor((a/b))) );
}
default
{
state_entry()
{
theta = PI/12;
llScaleTexture(1, 1, ALL_SIDES);
llOffsetTexture(0, 0, ALL_SIDES);
llSay(0, "Hello, Avatar!"

}
touch_start(integer total_number)
{
tmp = llGetTextureRot(0);
tmp = realmod(tmp + theta, TWO_PI);
llOffsetTexture(
realmod(llSqrt(.5) * llCos(tmp+PI/4) + .5, 1),
realmod(llSqrt(.5) * llSin(tmp+PI/4) + .5, 1),
ALL_SIDES
);
llRotateTexture(tmp, ALL_SIDES);
llSay(0, (string)tmp);
}
}