Convective-region geometry as the cause of Uranus' and Neptune's unusual magnetic fields