The Mathematics of the Spirograph