Putting labels on a cube with perspective
TikZ is not great for 3D. For best results in complex cases, you should use software designed for 3D drawing. The best you can do with TikZ is to fake 3D in 2D. For simple drawings, tikz-3dplot
can help with the faking by doing much of the calculation for you.
For example, here's a version of your cube done with this package:
Uncomment lines to see where the axes and coordinates used to construct the drawing are placed.
\documentclass[border=5pt,tikz,multi]{standalone}
\usepackage{tikz-3dplot}
\begin{document}
\tdplotsetmaincoords{45}{135}
\begin{tikzpicture}[tdplot_main_coords, my label/.style={midway, sloped}]
% \draw [->, help lines] (0,0,0) -- (4,0,0) node[anchor=north east]{$x$};
% \draw [->, help lines] (0,0,0) -- (0,4,0) node[anchor=north west]{$y$};
% \draw [->, help lines] (0,0,0) -- (0,0,4) node[anchor=south]{$z$};
\path (1,-1,1) coordinate (a) -- (1,1,1) coordinate (b) -- (-1,1,1) coordinate (c) -- (-1,-1,1) coordinate (d) -- cycle (a) -- (1,-1,-1) coordinate (e) -- (1,1,-1) coordinate (f) -- (-1,1,-1) coordinate (g) -- (-1,-1,-1) coordinate (h) -- (e);
\path [fill=magenta, fill opacity=.125] (a) -- (d) -- (h) -- (e) -- cycle;
\path [fill=blue, fill opacity=.125] (c) -- (d) -- (h) -- (g) -- cycle;
\path [fill=cyan, fill opacity=.125] (e) -- (f) -- (g) -- (h) -- cycle;
\path [fill=blue, fill opacity=.25] (a) -- (b) -- (f) -- (e) -- cycle;
\path [fill=magenta, fill opacity=.25] (c) -- (b) -- (f) -- (g) -- cycle;
\path [fill=cyan, fill opacity=.25] (a) -- (d) -- (c) -- (b) -- cycle;
\draw [gray] (e) -- (h) edge (g) -- (d);
\path (1,-1,0) coordinate (i) -- (1,1,0) coordinate (j) node [my label] {$Mol_{jl}$}
(0,-1,1) coordinate (k) -- (0,1,1) coordinate (l) node [my label] {$Mol_{ijkl}$}
(0,1,-1) coordinate (m) -- (l) node [my label] {$Mol_{kl}$}
(-1,1,0) coordinate (n) -- (-1,-1,0) coordinate (o) node [my label, gray, xscale=-1] {$Mol_{jk}$}
(0,-1,-1) coordinate (p) -- (k) node [my label, gray, yscale=-1] {$Mol_{ij}$}
(m) -- (p) node [my label, gray, scale=-1] {$Mol_{??}$}
;
\draw [thick, line join=round] (a) -- (b) -- (f) -- (e) -- cycle (a) -- (d) -- (c) -- (b) -- cycle (b) -- (c) -- (g) -- (f) -- cycle;
% \foreach \i in {a,b,...,p} \node [red,font=\tiny] at (\i) {\i};
\end{tikzpicture}
\end{document}
As I had indicated in a comment, one must slant and rotate text to produce an isometric viewpoint (though I realize the OP's drawing is actually true perspective, not isometric). The OP's code had already accounted for the text rotation, so all I did here was to slant it by +/-45 degrees, which was the approximate isometric sense adopted by the OP's image.
EDITED OP's code to place black objects in foreground; gray behind.
\documentclass[border=5mm,tikz]{standalone}
\usepackage{fp,amssymb}
\newsavebox\foobox
\newcommand\slbox[2]{%
\FPdiv{\result}{#1}{57.296}% CONVERT deg TO rad
\FPtan{\result}{\result}%
\slantbox[\result]{#2}%
}%
\newcommand{\slantbox}[2][30]{%
\mbox{%
\sbox{\foobox}{#2}%
\hskip\wd\foobox
\pdfsave
\pdfsetmatrix{1 0 #1 1}%
\llap{\usebox{\foobox}}%
\pdfrestore
}}
\newcommand\rotslant[3]{\rotatebox{#1}{\slbox{#2}{#3}}}
\usepackage{mwe}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\pgflowlevelscope{\pgftransformxscale{-1}}
\draw[gray!20](0.8,.9,1) node[rotate=90]{\rotslant{0}{45}{\textcolor{gray!20}{$Mol_{ij}$}}};
\endpgflowlevelscope ;
\pgflowlevelscope{\pgftransformxscale{-1}}
\draw[gray!20](-1,1,0) node{$Mol_{ik}$};
\endpgflowlevelscope ;
\draw[gray](2,0,0)--(0,0,0)--(0,2,0);
\draw[gray](0,0,0)--(0,0,2);
\draw[thick](2,2,0)--(0,2,0)--(0,2,2)--(2,2,2)--(2,2,0)--(2,0,0)--(2,0,2)--(0,0,2)--(0,2,2);
\draw[thick](2,2,2)--(2,0,2);
\draw(1,1,2) node{$Mol_{jl}$};
\draw(1,2,1) node{\rotslant{0}{45}{$Mol_{ijkl}$}};
\draw(2,1,1) node[rotate=90] {\rotslant{0}{-45}{$Mol_{kl}$}};
\end{tikzpicture}
\end{document}
In this revision, I try to more properly account for the perspective by vertically compressing the slanted text on the side/top faces (by introducing a \scalebox{1}[.75]{}
into the \slantbox
definition). Of course, this screws up the slant angles, which must be manually modified to recapture the proper look. Printing a \square
on a facet face gives an indication of whether the slant angles have been properly selected.
\documentclass[border=5mm,tikz]{standalone}
\usepackage{fp,amssymb}
\newsavebox\foobox
\newcommand\slbox[2]{%
\FPdiv{\result}{#1}{57.296}% CONVERT deg TO rad
\FPtan{\result}{\result}%
\slantbox[\result]{#2}%
}%
\newcommand{\slantbox}[2][30]{%
\scalebox{1}[.7]{\mbox{%
\sbox{\foobox}{#2}%
\hskip\wd\foobox
\pdfsave
\pdfsetmatrix{1 0 #1 1}%
\llap{\usebox{\foobox}}%
\pdfrestore
}}}
\newcommand\rotslant[3]{\rotatebox{#1}{\slbox{#2}{#3}}}
\usepackage{mwe}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\pgflowlevelscope{\pgftransformxscale{-1}}
\draw[gray!20](0.8,.9,1) node[rotate=90]{\rotslant{0}{40}{\textcolor{gray!20}{$Mol_{ij}$}}};
\endpgflowlevelscope ;
\pgflowlevelscope{\pgftransformxscale{-1}}
\draw[gray!20](-1,1,0) node{$Mol_{ik}$};
\endpgflowlevelscope ;
\draw[gray](2,0,0)--(0,0,0)--(0,2,0);
\draw[gray](0,0,0)--(0,0,2);
\draw[thick](2,2,0)--(0,2,0)--(0,2,2)--(2,2,2)--(2,2,0)--(2,0,0)--(2,0,2)--(0,0,2)--(0,2,2);
\draw[thick](2,2,2)--(2,0,2);
\draw(1,1,2) node{$Mol_{jl}$};
\draw(1,2,1) node{\rotslant{0}{35}{$Mol_{ijkl}$}};
\draw(2,1,1) node[rotate=90] {\rotslant{0}{-40}{$Mol_{kl}$}};
\end{tikzpicture}
\end{document}