How can I find all binary matrices $A$ that are a solution of matrix equation

$$A^3=B$$

for some given positive, integer square matrix $B$? Is there a way to characterize all the solutions?