%%% Testing:interactions between (x,y)-positioning and \TPMargin
% See https://bitbucket.org/nxg/textpos/issues/3/
% Thanks to Richard Schreiber for the report and initial test code.

\documentclass{minimal}
\usepackage[top=0mm,bottom=0mm,left=0mm,right=0mm,a5paper]{geometry}
\usepackage{color}
\usepackage[absolute,showboxes]{textpos}

\parindent0mm
\begin{document}

\textblockrulecolour{magenta}
\TPGrid[0mm,0mm]{6}{9}%
\TPMargin{5mm}%

\null\vskip 4cm
\noindent \hrule width 2\TPHorizModule
\smallskip
\hbox to 2\TPHorizModule{$\leftarrow$\hfil two units wide\hfil $\rightarrow$}

\begin{textblock}{2}(0,0)
  This box is top-left.
  The top and left margin lines touch the edge of the page.
\end{textblock}

\begin{textblock}{2}[0,1](0,9)
  This box should sit at the bottom left.
  The box should be two units wide, and the text correspondingly narrower.
  The bottom and left margin lines should touch the edge of the page.
\end{textblock}

\TPMargin*{5mm}
\begin{textblock}{2}[1,0](6,0)
  This box should sit at the top right of the page, and the text
  should be two units wide.  The top and right margin lines should be
  off the page.
\end{textblock}

\TPMargin{0mm}%
\begin{textblock}{2}[1,1](6,9)
  This box sits at the bottom right edge.
  The text and box are two units wide.
  The bottom and right margin lines touch the edge of the page.
\end{textblock}
\end{document}
