Function getRectPositioned

Returns a positioned rect or if it's not possible, throws an error.

If rect does not have a position, origin is used. If rect is positioned and origin is provided, returned result uses origin as x,y instead.

// Returns input because it's positioned
getRectPositioned({ x:1, y:2, width:10, height:20 });

// Returns { x:1, y:2, width:10, height:20 }
getRectPositioned({ width:10, height:20 }, { x:1, y:2 });

// Throws, because we have no point
getRectPositioned({width:10,height:20})