  Let $\Omega$ be a bounded domain in $\mathbb{R}^N$ with $C^2$ boundary and
let $K\subset\partial\Omega$ be either a $C^2$ submanifold of the boundary of
codimension $k<N$ or a point. In this article we study various problems related
to the Schr\"odinger operator $L_{\mu} =-\Delta - \mu d_K^{-2}$ where $d_K$
denotes the distance to $K$ and $\mu\leq k^2/4$. We establish parabolic
boundary Harnack inequalities as well as related two-sided heat kernel and
Green function estimates. We construct the associated Martin kernel and prove
existence and uniqueness for the corresponding boundary value problem with data
given by measures. Next we apply the results to the study of $L_\mu u+g(u) = 0$
and establish existence and uniqueness under suitable assumptions on the
function $g$. To prove our results we introduce among other things a suitable
notion of boundary trace. This trace is different from the one used by Marcus
and Nguyen \cite{MT} thus allowing us to cover the whole range $\mu\leq k^2/4$.
