Este es el código en AS3, por si alguien lo necesita:
Código PHP:
// coordenadas iniciales
var startP:Point = new Point(150,150);
var endP:Point = new Point(180,210);
var slop:Point = new Point(startP.x - endP.x, startP.y - endP.y);
var length:Number = Math.sqrt(slop.x * slop.x + slop.y * slop.y);
var slopVector:Point = new Point(slop.x/length, slop.y/length);
var rHeight:int = 5; // altura del rectángulo
var offset:Point = new Point(rHeight * slop.y / length, rHeight * -slop.x / length);
// obteniendo los 4 puntos para el dibujo
var topLeft:Point = new Point(startP.x - offset.x, startP.y - offset.y);
var bottomLeft:Point = new Point(startP.x + offset.x, startP.y + offset.y);
var topRight:Point = new Point(endP.x - offset.x, endP.y - offset.y);
var bottomRight:Point = new Point(endP.x + offset.x, endP.y + offset.y);
// dibujando el rectángulo
var shape:Shape = new Shape();
shape.graphics.lineStyle(1,0x000000);
shape.graphics.beginFill(0xFF0000);
shape.graphics.moveTo(topLeft.x, topLeft.y);
shape.graphics.lineTo(topRight.x, topRight.y);
shape.graphics.lineTo(bottomRight.x, bottomRight.y);
shape.graphics.lineTo(bottomLeft.x, bottomLeft.y);
shape.graphics.lineTo(topLeft.x, topLeft.y);
shape.graphics.endFill();
addChild(shape);