We consider the stationary flow of an inviscid and incompressible fluid of constant density in the region D=(0,L)×R2. We are concerned with flows that are periodic in the second and third variables and that have prescribed flux through each point of the boundary ∂D. The Bernoulli equation states that the "Bernoulli function" H:=21∣v∣2+p (where v is the velocity field and p the pressure) is constant along stream lines, that is, each particle is associated with a particular value of H. We also prescribe the value of H on ∂D. The aim of this work is to develop an existence theory near a given constant solution. It relies on writing the velocity field in the form v=∇f×∇g and deriving a degenerate nonlinear elliptic system for f and g. This system is solved using the Nash-Moser method, as developed for the problem of isometric embeddings of Riemannian manifolds; see e.g. the book by Q. Han and J.-X. Hong (2006). Since we can allow H to be non-constant on ∂D, our theory includes three-dimensional flows with non-vanishing vorticity.