In Shader Model 5.1 (required for DirectX 12), you certainly could use
SV_VertexID in the vertex shader to address different matrices in your constant buffer(s) to transform some of the vertices uniquely, but it's unlikely that in your case the performance difference would be worth the complexity. Unless you are drawing millions of these things, you'd be better off just having distinct vertices for the two shapes: A simple no-branching shader that doesn't need system-generated values is going to be faster than a complex, dynamic branching shader that requires extra information, so the extra vertex count isn't a problem in practice.
See Using System-Generated Values
SV_VertexID is also supported in Shadel Model 4 or later so you can use it with DirectX 11 with Direct3D Hardware Feature Level 10.0 or later. It's not supported for Direct3D Hardware Feature Levels 9.1, 9.2, or 9.3.