A 3D accelerometer would give you the attitude at any time in X, Y, Z.
Yeah, sorry, my comment was really about rates.
A 3D accelerometer cannot resolve attitudes with rotational symmetry about the local vertical. Most of the time a magnetometer can deal with that.
Magnetometer with only an accelerometer is usable only if the device moves very very slowly, otherwise the noise will make the data quickly useless. Also the magnetometers are slow devices - a typical accelerometer or gyroscope updates 1000x per second or more, a magnetometer typically only about 10-15x second.
If you want to go in this direction, then a better solution is a complete MARG - an accelerometer, gyroscope and magnetometer. The way it works is that you mostly rely on the gyro data which are nice low latency and with low noise and then "occasionally" (relatively speaking - still could be 100x a second!) correct for the gyro drift. Accelerometer gives the gravity vector, magnetometer corrected using the accelerometer for tilt gives you the magnetic north direction.
Now the math can be complex and building this out of three separate sensors is a pain - they need to have their axes perfectly aligned or you will have all sorts of weird and wonderful problems.
However, these days thanks to the smartphones one can buy something like the Invensense MPU-9250 integrated solution giving directly the orientation as a quaternion (or Euler angles, but those suck for all sorts of reasons). Another popular integrated device is the Bosch BNO 055 unit which also can do all the work for you.
The way the OP would use this would be to either build two of the sensors and have one fixed to the reference point. Then calculate the "difference" between the two orientations (there is some quaternion math for it). One sensor wouldn't be enough because the IMU is "absolute" and measures relative to the Earth (magnetic North & gravity directions). And this may change over time, e.g. by introducing metal near the apparatus. So it would have to be either calibrated quite often or just use two sensors.
I have built this kind of device using the MPU-9250 and an STM32F103 micro, it works like a charm. However, it is not a beginner project - the MPU-9250 can be fiddly and freeze if you send it bad data and soldering it is impossible without reflow oven or hot air - 0.4mm pin pitch QFN with 24 pins and some 3x3mm size ... if you don't mind larger size, there are some breakout boards for them though.
Also, if you don't have the knowledge/time to spend on this, you can actually buy a ready-to-go sensor - e.g. the InterSense InertiaCube:
http://www.intersense.com/pages/18/234However, be prepared for the sticker shock. Moreover, the device doesn't do anything more than the MARG solution above.