\documentclass{article}
\usepackage{gensymb}
\usepackage[pdftex,active,tightpage]{preview}
\setlength\PreviewBorder{2mm}
\usepackage{tikz}
\usetikzlibrary{arrows, calc, positioning,decorations.pathreplacing,shapes} 
\tikzset{
    %Define standard arrow tip
    >=stealth',
    % Define arrow style
    pil/.style={
           ->,
           thick},
    line/.style={
        very thick,
        black,
        to path={% works only with "to" and not "--"
            -- (\tikztotarget) node[at start,point] {} node [at end,point] {} \tikztonodes
        }
    },
    point/.style={
        thick,
        draw=gray,
        cross out,
        inner sep=0pt,
        minimum width=4pt,
        minimum height=4pt,
    },
}

\begin{document}
\begin{preview}
  \begin{tikzpicture}
    \newcommand\MinX{0}
    \newcommand\MinY{0}
    \newcommand\MaxX{4}
    \newcommand\MaxY{5}

    % Coordinate system
    \draw [<->, thick, red] (0,{\MaxY+0.5}) -- (0,0) -- ({\MaxX+0.5},0);

    \coordinate (A) at (1,2);
    \coordinate (B) at (3,5);
    \coordinate (C) at (1.5,0.5);
    \coordinate (D) at (4,1.5);

    \draw[color=orange, very thick, fill=orange!20] (1,2) -- (3,2) -- (3,5) -- (1,5) -- cycle;
    \draw[color=orange, very thick, fill=orange!20] (1.5,0.5) -- (4,0.5) -- (4,1.5) -- (1.5,1.5) -- cycle;

    \draw[line] (A) -- (B);
    \draw[line] (C) -- (D);

    \draw[step=0.5cm,color=gray] ({\MinX-0.25}, {\MinY-0.25}) grid ({\MaxX+0.25},{\MaxY+0.25});
    \path[every node/.style={point}]
         node at (A) {}
         node at (B) {}
         node at (C) {}
         node at (D) {};
  \end{tikzpicture}
\end{preview}
\end{document}
