Rectangles around words in table including diagonals

run with xelatex

\documentclass[]{article}
\usepackage{pst-node}
\begin{document}
\begin{psmatrix}[colsep=1cm, rowsep=1cm]
     A1& B1& C1& D1 \\
     A2& B2& C2& D2 \\
     A3& B3& C3& D3 \\
     A4& B4& C4& D4 
\end{psmatrix}  
\ncbox[linecolor=blue,nodesep=5pt,linearc=0.4]{2,1}{1,2} 
\ncarcbox*[linecolor=yellow,nodesep=5pt,linearc=0.4,arcangle=50,opacity=0.4]{2,2}{3,4} 
\ncbox[linecolor=red,nodesep=5pt,linearc=0.4]{2,3}{4,4}

\end{document}

enter image description here

if you need it with curves then look here: http://tug.org/PSTricks/main.cgi?file=Lines/lines#curves


This is one way to do, where matrix node is used

enter image description here

Code

\documentclass[]{article}
\usepackage{tikz}
\usetikzlibrary{matrix,shapes,arrows}
\begin{document}
\begin{tikzpicture}%[thick]
  \matrix (mat) [%
    matrix of nodes, column sep=1cm, row sep=1cm
  ] 
  {%
     A1& B1& C1& D1 \\
     A2& B2& C2& D2 \\
     A3& B3& C3& D3 \\
     A4& B4& C4& D4 \\
  };  
  \draw[blue,very thick, rounded corners] (mat-2-1.north west) --(mat-1-2.north west) -| (mat-1-2.south east)-- (mat-2-1.south east) -| (mat-2-1.north west); 

 \draw[yellow,very thick] (mat-2-2.north west) -| (mat-2-2.south east) -- (mat-3-2.south east) -- (mat-3-2.south west) --(mat-2-2.north west); 

 \draw[green,very thick] (mat-1-3.north west) -| (mat-1-3.south east) -- (mat-2-3.south east) -- ++(0,-0.5cm) -| (mat-1-3.north west); 

 \draw[red,very thick] (mat-2-3.north west) -| (mat-2-4.north east) -- (mat-2-4.south east) -- (mat-2-3.south west)-- ++(-0.5cm,0) |-(mat-2-3.north west); 
\end{tikzpicture}
\end{document}