Nonlinear theory of geostrophic adjustment. Part 1. Rotating shallow-water model