I know the "d" in German tends to be voiced when its at the start of a words and voiceless when its at the end, but I've never really known what the rule technically is.
German d does not tend to be voiced at the start of words. If anything, then it tends to be voiceless everywhere. In the entire Southern part of the German speaking area, it is always voiceless. In the Northern part, it is also voiceless unless entirely surrouned by voiced sounds. In that sense, voice is not a distinctive feature of German obstruents, but only an accidental feature that may be present under certain conditions in certain regions.
What you are probably asking about is the phenomen called Auslautverhärtung. In English, this is usually translated as final devoicing, which is somewhat of a misnomer when speaking about German, since voicing is not a distinctive feature of obstruents to start with. Literally, it means ‘final hardening’, which more accurately characterizes the phenomenon. In German varieties that have Auslautverhärtung, final “soft” obstruents like d (traditionally called lenis sounds) are pronounced exactly as if they were “hard” obstruents like t (traditionlly called fortis sounds):
- The word Rad is pronounced exactly like the word Rat.
- The word Bund is pronounced exactly like the word bunt.
Auslautverhärtung is typical of Northern German varieties. There is a strong prescriptivist tradition that elevates the Northern German pronunciation to the one and only true pronunciation of standard German. According to this prescriptivist point of view, Auslautverhärung is a characteristic of German proper. In a more neutral point of view, all we can say is that some pronunciations of standard German have Auslautverhärtung and others don’t, just like some pronunciations of English are rhotic and others are not – the times when only the Queen’s non-rhotic Received Pronunciation counted as English proper have long passed.
Well, let's try and observe our pronunciation.
Dunkelkammer vs. Tunnelbohrung
Dachstuhl vs. Tannenbaum
Drückeberger vs. Trottel
We see (or hear): the D- are more "voiced" than the T-, but this seems not to be the most important difference. Rather, it is the strength of the obstruction to the stream of air which then is released. The T is just more powerful in all aspects. I would say, this fits well into the concept of "lenis" and "fortis" mentioned in Janka's earlier comment.
Petersilienbund vs. kunterbunt
Tellerrand vs. rumgerannt
Weiderind vs. spinnt
I would say, these -d and -t are rather similar (at last in what I would call standard German), they are voiceless, but importantly all of them, both d and t, are aspirated, i.e. an audible stream of air passes through the mouth after it forced by a contraction of the lung (or other respiratory organs).