Geometry of Gerrymandering