  The shifted boundary method (SBM) is an approximate domain method for
boundary value problems, in the broader class of unfitted/embedded/immersed
methods. It has proven to be quite efficient in handling problems with complex
geometries, ranging from Poisson to Darcy, from Navier-Stokes to elasticity and
beyond. The key feature of the SBM is a {\it shift} in the location where
Dirichlet boundary conditions are applied - from the true to a surrogate
boundary - and an appropriate modification (again, a {\it shift}) of the value
of the boundary conditions, in order to reduce the consistency error. In this
paper we provide a sound analysis of the method in smooth and non-smooth
domains, highlighting the influence of geometry and distance between exact and
surrogate boundaries upon the convergence rate. Without loss of generality, we
consider the Poisson problem with Dirichlet boundary conditions as a model and
we first detail a procedure to obtain the crucial shifting between the
surrogate and the true boundaries. Next, we give a sufficient condition for the
well-posedness and stability of the discrete problem. The behavior of the
consistency error arising from shifting the boundary conditions is thoroughly
analyzed, for smooth boundaries and for boundaries with corners and edges. The
convergence rate is proven to be optimal in the energy norm, and is further
enhanced in the $L^2$-norm.
