You could - if the Desire HD actually had gyros

It doesn't, it deduces its orientation in space from the output of its accelerometer, wherever the gravity vector points is down

The iPhone 4 on the other hand does have a solid state gyro system in addition to accelerometers, I suppose one could do something with that...