\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\usepackage{xepersian}
\newcommand\tikzmark[1]{%
  \tikz[overlay,remember picture,baseline] \node [anchor=base] (#1) {};}

\newcommand\MyLine[3][]{%
  \begin{tikzpicture}[overlay,remember picture]
    \draw[#1] (#2) -- (#3);
  \end{tikzpicture}}

\begin{document}
متن نمونه  متن نمونه متن نمونه متن نمونه متن نمونه  متن نمونه متن نمونه متن نمونه متن نمونه 

\[
\begin{pmatrix}
\phantom{0}\tikzmark{c} & \phantom{0}\tikzmark{e} & & & \tikzmark{a}\phantom{5}  \\
\phantom{0}\tikzmark{b}& & & & \\
& & & & \tikzmark{f}\phantom{0} \\
& & & \phantom{0}\tikzmark{e} & \tikzmark{d}\phantom{0}\\
\end{pmatrix}
\] 
\MyLine[blue,thick]{c.north west}{d.south east}
\MyLine[blue,thick]{c.north west}{a.north east}
\MyLine[blue,thick]{a.north east}{d.south east}
\MyLine[blue,thick]{b.north west}{e.south west}
\end{document}