Well-posed boundary conditions for the shallow water equations