Added rotation function and rectangle structure