Is there an algorithm to determine whether a given simple graph $G$ is a product graph, typically, say a cartesian product graph of two smaller simple graphs $G_1, G_2$, such that the two simple graphs have the cartesian product of their vertex sets having the same cardinality of the graph $G$, that is, $V(G_1)\times V(G_2)=V(G)$?

Since every graph could be written as a cartesian product of some graphs(though some might be degenerate), I think it would be possible to determine whether a graph is the product (any graph product) of two simpler graphs in a nice way.