An Automated Sunspot Identification and Tracking Algorithm to Investigate the Rotation of Sunspots