Javascript How Do You Rotate A Rectangle With Points Inside Stack

Javascript How Do You Rotate A Rectangle With Points Inside Stack