Tracking and analysing squares