Wait, what? PIXI Matrix is not immutable?
Ah, my bad.
g.lineTextureStyle({width:40 , texture:texture , alignment:0, matrix: PIXI.Matrix.IDENTITY.clone().scale(the scale you need)});
I think he meant this:
g.lineTextureStyle({width:40 , texture:texture , alignment:0, matrix: PIXI.Matrix.IDENTITY.scale(the scale you need)});
And you can calculate the scale like this:
scaleX = rectWidth / TEXTURE_SIZE
scaleY = rectHeight / TEXTURE_SIZE