Let $M$ be a compact connected manifold with boundary whose interior has dimension $n\geq 2$. Suppose that we have a map $f:M\rightarrow S^n$ which is continuous and such that the restriction of $f$ to the boundary of $M$ is injective. Suppose further that $f$ is locally injective - that is, for each $p\in M$, there is an open $U$ containing $p$ such that the restriction of $f$ to $U$ is injective.
Does it follow that $f$ is injective?
I thought of this question while I was studying some discrete geometry. For my purposes, I was able to prove and use the weaker statement that if $f:M\rightarrow \mathbb R^n$ satisfies the given conditions and has that the image of the boundary of $M$ under $f$ is the boundary of a convex set $C$, then $f$ is injective.
I proved this by first noting that the image of the interior of $M$ is a subset of the interior of $C$, which follows from the fact that the dot product $f(x)\cdot v$ may have no local minima or maxima on the interior of $M$ due to invariance of domain.
Then, I suppose that I have a pair $x,y$ of distinct points in the interior with $f(x)=f(y)$. If I choose any path $\gamma$ between them in the interior of $M$, then I would have that $\alpha=f\circ \gamma$ was a loop based at $f(x)=f(y)$. However, $\alpha$ has a homotopy $H$ to the trivial curve $H(p,t)=(1-t)\alpha(p)+tf(x)$. Then, we show that we can lift this to some homotopy $\tilde H$ such that $\tilde H(p,0)=\gamma(p)$ and $f\circ \tilde H = H$. However, this is a problem since if we define $\beta(p)=\tilde H(p,1)$, we have that $\beta(0)=x$ and $\beta(1)=y$, but $f\circ \beta$ is constant, contradicting local injectiveness.
My trouble with extending the statement is that my argument is littered with geometrical facts, and even though I suspect that similar methods should work in the more general case I ask about, I can't figure out how.