\documentclass{standalone}
\usepackage[polish]{babel}
\usepackage[utf8]{inputenc} 
\usepackage[T1]{fontenc}
\usepackage{fourier}
\usepackage{tikz}


\begin{document}

\begin{tikzpicture}
\draw[step=5mm,draw=gray,dashed] (0,0) grid (4,4);
\draw (0,0) -- (1,1) rectangle (3,3) -- (4,4) .. 
  controls (4,0.5) and (3.5,0) .. (0,0);
\draw[fill=gray!20!] (1,1) -- ++(0.5,0) arc (0:90:0.5) -- cycle;
\draw[fill=gray!20!] (3,3) -- ++(-0.5,0) arc (180:270:0.5) -- cycle;
\end{tikzpicture}

\end{document}