How can I force the pattern of a dashed line to be shifted/modified in such way that it does not start/end with a space?
Simple example:
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw coordinate (nw) (0,0) rectangle (4,4) coordinate(se);
\path (nw)--coordinate (aux) (se);
\draw[dashed] (nw|-aux)--(aux-|se);
\end{tikzpicture}
\end{document}
In the resulting output the line ends with a space.

If se is at (3,3) the line both starts and ends with no space:
