As has already been pointed out the net flux across any closed surface is the same and only depends on the charge enclosed. That does not necessarily mean the the flux over a given surface area will be the same as you have found out comparing the cube to the sphere. It decreases as you move away from the center of a face of the cube whereas it is constant over the entire surface of the sphere if the charge is in the center. But the total flux is obtained by summing up (integrating) the flux over the entire surface. Consider that for a cube and sphere of the same volume, the surface area of the cube is greater than the surface area of the sphere. Hope this helps