Just for fun: everything is in 2D
\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}
\draw (0,0) rectangle (1,1) (1,1) rectangle (2,2) (0,1) rectangle (1,2) (0,2) rectangle (1,3) (1,0) rectangle (2,1) (2,0) rectangle (3,1);
\draw (3.6,1.6)--(3.6,.6)--(3,0)--(3,1)--cycle--(3.6,2.6)--(2.6,2.6)--(2.6,3.6)--(.6,3.6)--(0,3);
\draw (2,1)--(2.4,1.4) (2,2)--(2.6,2.6) (1,2)--(1.4,2.4) (1,3)--(1.6,3.6) (2.4,3.4)--(2.6,3.6) (3.4,2.4)--(3.6,2.6);
\draw (2.4,1.4) rectangle (3.4,2.4) (1.4,2.4) rectangle (2.4,3.4);
\draw (.4,3.4)--(1.4,3.4) (3.4,1.4)--(3.4,.4) (.2,3.2)--(1.2,3.2)--(1.2,2.2)--(2.2,2.2)--(2.2,1.2)--(3.2,1.2)--(3.2,.2);
\end{tikzpicture}
\end{document}

With colors
\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}
\fill[black!70] (3,0)--(3.6,.6)--(3.6,2.6)--(3.4,2.4)--(3.4,1.4)--(3,1)--cycle (2.4,2.4)--(2.6,2.6)--(2.6,3.6)--(2.4,3.4)--(2.4,1.4)--(2,1)--(2,2)--cycle (1,2)--(1.4,2.4)--(1.4,3.4)--(1,3)--cycle;
\fill[black!30] (0,3)--(.6,3.6)-_(2.6,3.6)--(2.4,3.4)--(1.4,3.4)--(1,3)--cycle (2.4,2.4)--(2.6,2.6)--(3.6,2.6)--(3.4,2.4)--(1.4,2.4)--(1,2)--(2,2)--cycle (2,1)--(2.4,1.4)--(3.4,1.4)--(3,1)--cycle;
\draw (0,0) rectangle (1,1) (1,1) rectangle (2,2) (0,1) rectangle (1,2) (0,2) rectangle (1,3) (1,0) rectangle (2,1) (2,0) rectangle (3,1);
\draw (3.6,1.6)--(3.6,.6)--(3,0)--(3,1)--cycle--(3.6,2.6)--(2.6,2.6)--(2.6,3.6)--(.6,3.6)--(0,3);
\draw (2,1)--(2.4,1.4) (2,2)--(2.6,2.6) (1,2)--(1.4,2.4) (1,3)--(1.6,3.6) (2.4,3.4)--(2.6,3.6) (3.4,2.4)--(3.6,2.6);
\draw (2.4,1.4) rectangle (3.4,2.4) (1.4,2.4) rectangle (2.4,3.4);
\draw (.4,3.4)--(1.4,3.4) (3.4,1.4)--(3.4,.4) (.2,3.2)--(1.2,3.2)--(1.2,2.2)--(2.2,2.2)--(2.2,1.2)--(3.2,1.2)--(3.2,.2);
\end{tikzpicture}
\end{document}

~version inside a group, even if it's just to shorten your code. As in,\begingroup \def~{pic{code}} \begin{tikzpicture} ... \end{tikzpicture}. – Werner Apr 01 '19 at 19:22\pgfextraand{...}only to avoid{and}?\tikz[z={(.4,.3)}]{\def~{pic{cube}} \path (2,0,2)~(2,0,1)~(0,0,0)~(1,0,0)~(2,0,0)~ (2,1,2)~(1,1,1)~(0,1,0)~(1,1,0)~ (0,2,2)~(1,2,2)~(0,2,1)~(0,2,0)~;}– Apr 01 '19 at 20:23~is not a good practice, I decided to follow the comment of @Werner and to make its definition as local as possible : so local to the path is better to local for the entire tikz. – Kpym Apr 01 '19 at 20:49\documentclass[tikz,border=7pt]{standalone} \tikzset{ cube/.pic={ \draw[fill=black!20] (0,1,0) -- (0,1,1) -- (1,1,1) -- (1,1,0); \draw[fill=black!50] (1,0,0) -- (1,0,1) -- (1,1,1) -- (1,1,0); \draw[fill=white] (0,0,0) rectangle (1,1,0); },icube/.style={insert path={#1 pic{cube}}} } \begin{document} \tikz[z={(.4,.3)}]\path[icube/.list={(2,0,2),(2,0,1),(0,0,0),(1,0,0),(2,0,0), (2,1,2),(1,1,1),(0,1,0),(1,1,0), (0,2,2),(1,2,2),(0,2,1),(0,2,0)}]; \end{document}– Apr 01 '19 at 20:59