I'm not super familiar with what i did in the example anymore and it's too much trouble for me to use a multitouch device to test but you could possibly do the following. Considering I haven't made any math errors.
Basically keep track of the current and previous positions of the touches and then use a dot product to get a signed distances in particular directions (parellel and perpendiculat to the box's angle). Basically that's to get the scaling factors in either direction. Next in order to actually scale in those directions I used another dot product like above and then used some trig to get a resulting position. Likely the math could be simplified further if you like.
global number oldtouch0x=0
global number oldtouch0y=0
global number oldtouch1x=0
global number oldtouch1y=0
on touch 0
--- set oldtouch0x to touch(0).x
--- set oldtouch0y to touch(0).y
on touch 1
--- set oldtouch1x to touch(1).x
--- set oldtouch1y to touch(1).y
touch id 0 is touching
--- box: set position to self.x+(touch(0).x-oldtouch0x), self.y+(touch(0).y-oldtouch0x)
global number ang=0
global number xscaling=0
global number yscaling=0
global number dotn=0
global number dotd=0
global dotx=0
touch id 1 is touching
--- set dotn to cos(box.angle)*(touch(1).x-touch(0).x)+sin(box.angle)*(touch(1).y-touch(0).y)
--- set dotd to cos(box.angle)*(oldtouch1x-oldtouch0x)+sin(box.angle)*(oldtouch1y-oldtouch0y)
--- set dotx to cos(box.angle)*(box.x-touch(0).x) +sin(box.angle)*(box.y-touch(0).y)
--- set xscaling to dotn/dotd
--- set dotn to cos(box.angle+90)*(touch(1).x-touch(0).x)+sin(box.angle+90)*(touch(1).y-touch(0).y)
--- set dotd to cos(box.angle+90)*(oldtouch1x-oldtouch0x)+sin(box.angle+90)*(oldtouch1y-oldtouch0y)
--- set doty to cos(box.angle+90)*(box.x-touch(0).x) +sin(box.angle+90)*(box.y-touch(0).y)
--- set yscaling to dotn/dotd
--- box: set x to touch(0).x+xscaling*dotx*cos(box.angle)+yscaling*doty*cos(box.angle+90)
--- box: set y to touch(0).y+xscaling*dotx*sin(box.angle)+yscaling*doty*sin(box.angle+90)
--- box: set size to (self.width*xscaling, self.height*yscaling)
touch id 0 is touching
--- set oldtouch0x to touch(0).x
--- set oldtouch0y to touch(0).y
touch id 1 is touching
--- set oldtouch1x to touch(1).x
--- set oldtouch1y to touch(1).y