Hi!
First of all, let me say I didn't quite get what you were trying to achieve, and I believe most people won't. How does a cube "face" "north" or "northwest"? There are six different faces that can face the "given direction". So for now let's assume that you have an object that can actually "face" some direction in a single way(for example a vector). Now I am not really sure what you meat by "north" etc. when it comes to 3d space. "North", "west", "east" and "south" are used for 2d maps as far as I know, in 3d space you can have an infinite number of 2d planes, even assuming you consider only the three main planes you'll have XY, XZ, YZ. I'll assume you meant the the XZ plane as you said you wanted to rotate the cube around (it's?) Y axis. But to rotate an object only around axis, you really need either only the X or Y movement of the mouse. I'll assume however that you want both of them somehow to portray the directional vector for the object.
So if I got you right (which I am not really sure about), you want the directional vector for the cube/object("where it's facing to) to be defined from the vector from the center of the screen to your mouse coords(considering in the center of the screen the mouse coords is the pair 0,0). What I'd do in this situation is to first get my mouse pair coords (Mx, My) and then actually map it to the XZ plane(you want to rotate the cube around Y right?), so I'd get something like this for the directional vector(let's call it v2) for the object:
(Mx, 0, My) - basically the x direction will be defined by how you move your mouse from left to right and the z direction by how you move your mouse forward/backward. And I believe you should get the "mouse on positive Y axis = north" etc. behaviour you're looking for. You should of course consider the scenario when you have a directional vector pair equal to the zero vector: Mx=My=0 => (0,0,0), then you can use some default direction for the cube.
Now, I do not know whether you have some function to align an object to a vector, but you can always calculate the needed rotation. If you have a default directional vector for the cube v1 and you have the new one v2, then you can calculate the angle of rotation around the Y axis in numerous ways, you can find the angle from the dotproduct of v1 and v2 and then define in which direction it's being rotated by looking at the vector product's direction. You can also write the coordinates of the new directional vector in polar form and then define the angle of rotation from there(you'll only need the angle for rotation around Y) etc.
Hope that helps.
P.S.
I'd advise the polar coordinate conversion, I believe it will be the easiest.
http://en.wikipedia.org/wiki/Polar_coordinate_system#Converting_between_polar_and_Cartesian_coordinates
http://en.wikipedia.org/wiki/Dot_product
http://en.wikipedia.org/wiki/Vector_product
Decided I won't be stingy and give the full example, after reading your post again and seeing you wanted the "formula":
If the x,y coords of your mouse in the center of the screen are not 0 you'll need to map them there.
Assuming the center of your screen has screen coords x0,y0 then to get the new coords of the mouse relative to a center scree 0,0 you'll do this:
1) Current mouse coords relative to some screen coord system not starting at the center of the screen - (mx0,my0)
2) Converting them to new coords mx,my relative to the new screen coord system (mx = mx0-x0, my= my0-y0) (you may have to do other transformation if the coord system is not witht the same handedness, however I believe that if you're using directX the screen coords start at the left top corner of the screen, so you'll need to have x0= screenWidth/2, y0= screenHeight/2).
3) Here' what you'll have for the directional vector: v2 = (mx, 0, my)
4) To find the angle based on the coordinates: YRotationAngle = atan2(my,mx).
5) Just rotate the cube by YRotationAngle on the Y axis.