It's pretty infuriating to ever have to move a dialog box that appears over the related content that was of interest, so I tend to observe the following hierarchy of rules, but the gist is that the more specific the context, the closer the dialog should be positioned.
If the dialog is a context menu or similar to a context menu, position the top left at the click position. Eg right mouse button menu
If the dialog was brought up as a result of a direct click on a menubar, then position so that top left of dialog is just above and left of the mouse position. Eg: Save as dialog
If interaction with dialog relates to something specific in the presentation area which the user clicked on then position the dialog so as to still be able to view that object but in a way that observes consistent rules. A nice option is to point an arrow off the top of the dialog to the object in question, or highlight it in some other way. Eg. Selected object information. Object Format dialog.
If the dialog is pretty standalone in that it does not directly reference a specific object underneath, then position it central to the main content/graphics/working/presentation area. Eg Content statistics summary.
If the dialog relates to functionality within the application as a whole, position it central to the main window, (not central to the screen). Eg: An application settings dialog. Font dialog.
If the dialog relates to the application within the context of the operating system - then position it central to the relevant screen. Eg: a crash report dialog.
Additionally - for those user-moveable dialogs that you positioned centralized to either content, main winow, or screen, and where you have control of this, you remember previous positions. Eg you record the size and position of the dialog when it was opened and compare with the size and position when closed, and if the user moved it, the next time the dialog appears - you ensure it is given the same size and position as the user obviously wanted it. Thus if for some reason the user didn't like the position, you adhere to their wishes instead of continually ignoring them. Users will get used to finding dialogs in the 'position they left them' and it's a much better experience than keep having the dialog appear in the same annoying place all the time.
See also - Microsoft's Window Management Guidelines as part of their UX guidelines