Without knowing the details of the vector field, I can't give you a direct answer for the flux. At any rate, the general idea would be to use the divergence theorem, which states the flux of over the closed surface (surface of a cube in this case) is equivalent to the integral of the divergence of over the interior of the surface (call it ):
The latter integral is less work to compute, and hence the usefulness of the divergence theorem. Denoting the vector field by , we have