If a continuous function is locally injective and injective on the boundary, is it injective? 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.
 A: Indeed, such a map is injective under the following mild extra assumption:
Let $N$ denote $\partial M$. Then require that $f|N$ is tame.
In other words, there is a product neighborhood $U\cong (-1,0]\times N$ of $N$ in $M$ such that the restriction $f|U$ extends to a continuous injective map $F: (-1,1)\times N \to  S^n$. (There are alternative definitions of tameness, intrinsic to the restriction $f|N$, but this one is the simplest to work with.) 
This tameness property is automatic if $M$ and $f$ are $C^1$-smooth. In general, however, it fails (consider a horned sphere). 
Assume now that $f|N$ is tame. Then there exists a submanifold with boundary $L\subset S^n$ such that $\partial L= f(N)$ and $L$ contains $F([0,1)\times N)$ in the above description. Therefore, we can define a connected closed manifold (i.e. compact without boundary) $X$ by gluing $M$ and $L$ via the map $f^{-1}|f(N)$. Then we obtain an obvious continuous map $g: X\to S^n$ by combining $f|M$ with the identity embedding $id: L\to S^n$. One then checks that $g$ is a local homeomorphism. Since $X$ is closed compact, $g: L\to S^n$ is a covering map (by the "stack of records theorem"). However, $S^n$ is simply connected, hence, $g$ is a homeomorphism, and, thus $f$ is injective. qed
I think one can adjust this proof to make it work without tameness assumption (by replacing $M$ with a slightly smaller submanifold). Let me know if you need this. (Most people work in the smooth category anyway.)     
