Geometry Reveals the Tricks Behind Gerrymandering