Moved code for rectangle primitive generation to client side