How do I create the layout for this rotary encoder on a pcb?
Yes, the squares are the holes for mounting tabs.

It's easier for PCB fabs to drill round plated holes than to make square ones.  Often, PCB fabs charge extra for plated non-round holes.  You can use round holes for mounting tabs.  To be on a safe side, make the hole slightly larger than the diagonal (3.2mm) of the recommended square hole.